<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script language="JavaScript" src="/js/vue.min.js"></script>
    <script language="JavaScript" src="/js/axios.min.js"></script>
</head>
<body>
<div id="BookDiv">
    <table border="1">
        <tr>
            <td>编号</td>
            <td>名称</td>
            <td>内容</td>
            <td>数量</td>
            <td>价格</td>
        </tr>
        <tr v-for="book in bookInforList">
            <td>{{book.bid}}</td>
            <td>{{book.bookname}}</td>
            <td>{{book.bookcontent}}</td>
            <td>{{book.booknumber}}</td>
            <td>{{book.bookprice}}</td>
        </tr>
    </table>
    <a href="/book_add.html">添加图书</a>
</div>
<script language="JavaScript">
    var vm = new Vue({
        el: "#BookDiv",
        data: {
            bookInforList: []
        },
        created() {
            this.findbooklist();
        },
        methods: {
            findbooklist: function () {
                var path = "http://localhost:8070/book/findall"
                axios.get(path).then(function (obj) {
                    alert(obj.status)
                    if (obj.status == 200) {
                        var pathResult = obj.data;
                        vm.bookInforList = pathResult.obj;
                        alert("查询列表:" + vm.bookInforList)
                        return;
                    }
                }).catch(function (error) {
                    alert("有异常了")
                })
            }
        }
    });
</script>
</body>
</html>